package MVC;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;

public abstract class View {

    /* Atributos */
    public static JFrame frame = new JFrame("Pentago");
    public static JMenuBar menuBar = new JMenuBar();
    public static JMenu jogoMenu = new JMenu("Jogo");

    /* Métodos */
    public void open() {
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.pack();

        menuBar.add(jogoMenu);
        frame.setJMenuBar(menuBar);
    }

    public void show() {
        frame.setVisible(true);
    }

    public void hide() {
        frame.setVisible(false);
    }

    public void quit() {
        frame.dispose();
    }

    public void alert(String msg) {
        JOptionPane.showMessageDialog(frame, msg);
    }

    public Boolean confirm(String msg) {
        return JOptionPane.showConfirmDialog(frame, msg) == 0;
    }

    public abstract void rendered();

    public abstract void refresh();

    public abstract JPanel mainPanel();

}
